/**
 * @file
 * @author  Tsin Smith <tsin.creator@gmail.com>
 *
 * @section DESCRIPTION
 *
 * An abstract interface for runtime images.
 *
 */

#ifndef __TSIN_DISPLAY_IMAGE_HPP__
#define __TSIN_DISPLAY_IMAGE_HPP__

#include <tsin/display/common.hpp>

#include <tsin/util/Resolution.hpp>
#include <tsin/util/RefCnt.hpp>

namespace tsin {

        /**
         * @class Image
         * @ingroup display
         * @brief Most abstract interface for all images loaded.
         *
         * Loading an image MUST call open() explicitly. The destructor of the
         * implementations are in charge of unloading the image.
         */
        class DISPLAY_DLLEXPORT Image : public RefCnt {
        public:
                virtual ~Image() {};

                /**
                 * Open an image.
                 *
                 * @param path Absolute or relative path of the image to be
                 *             load.
                 * @return true if the image is successfully loaded or false
                 *         otherwise.
                 */
                virtual bool open(const char *path, StandardResolution res) = 0;

                /**
                 * Get the width in pixel of the image.
                 *
                 * @return The width in pixel if the image is loaded or 0
                 *         otherwise.
                 */
                virtual int getWidth() = 0;

                /**
                 * Get the height in pixel of the image.
                 *
                 * @return The height in pixel if the image is loaded or 0
                 *         otherwise.
                 */
                virtual int getHeight() = 0;

                /**
                 * Get the handle represented by an integer of this image.
                 *
                 * @return The valid handle if an image is loaded or
                 *         0 otherwise.
                 */
                virtual unsigned int getHandle() = 0;

                virtual StandardResolution getResolution() = 0;

        protected:
                StandardResolution resolution;
        };
}

#endif /* __TSIN_DISPLAY_IMAGE_HPP__ */
